<?php

/**
 *
 * walkfolders: Don't stop at folders (default: false)
 * alwaysopen : Depth of nodes to be always in open state (needed for js navis) (default: 0)
 * tpl        : Navigation template
 * depth      : Maximum depth of navigation
 * rootid     : Rootid of navigation
 */


require_once($cfgPaths['lib']."cms/methods/inc/hierarchicalTplNav.o.inc.php");
require_once($cfgPaths['lib']."cms/cmsNavConfParser.o.inc.php");


    if (file_exists($cfgPaths['template']."cms/dnav/".$params['tpl']))
    {
        $parser = new cmsNavConfParser($tmpl);
        $parser->parse(file($cfgPaths['template']."cms/dnav/".$params['tpl']));
        
        $walkfolders = false;
        if (!empty($params['walkfolders']))
        {
            $walkfolders = true;
        }
        $menu = new hierarchicalTplNav($is_live,$docs->getTable(),$doc_id,$tmpl,$params['depth'],$params['rootid']?$params['rootid']:0,false,$walkfolders);
        if (!empty($params['alwaysopen']))
        {
            $menu->alwaysOpen($params['alwaysopen']);
        }
        print $menu->getOutput();
        unset($tmpl);
    }
    else
    {
        return "<b>Error:</b> Menu Template not found! (".$cfgPaths['template']."cms/dnav/".$params['tpl'].")<br />";
    }
    
?>